package com.design.adapter.print;

// 适配器类，将 ModernPrinter 适配成 LegacyPrinter
class PrinterAdapter extends LegacyPrinter {
    private ModernPrinter modernPrinter;

    public PrinterAdapter(ModernPrinter modernPrinter) {
        this.modernPrinter = modernPrinter;
    }

    @Override
    public void print(String text) {
        // 调用 ModernPrinter 的兼容方法
        modernPrinter.printText(text);
    }
}
